<?php

namespace Ue\ErpBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

use Ue\ErpBundle\Entity\Warehouse;

use Ue\ErpBundle\Entity\Method;
use Ue\ErpBundle\Entity\Platform;
use Ue\ErpBundle\Entity\Status;
use Ue\ErpBundle\Entity\OrderAddress;

/**
 * Order
 *
 * @ORM\Table(name="ue_order", indexes={@ORM\Index(name="status_id_idx", columns={"status_id"}), @ORM\Index(name="method_id_idx", columns={"method_id"}), @ORM\Index(name="platform_id_idx", columns={"platform_id"}), @ORM\Index(name="ue_order_warehouse_id_idx", columns={"warehouse_id"})})
 * @ORM\Entity
 */
class Order
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var integer
     *
     * @ORM\Column(name="parent_id", type="integer", nullable=true)
     */
    private $parentId;

    /**
     * @var string
     *
     * @ORM\Column(name="original_no", type="string", length=32, nullable=false)
     */
    private $originalNo;

    /**
     * @var string
     *
     * @ORM\Column(name="order_no", type="string", length=32, nullable=false)
     */
    private $orderNo;

    /**
     * @var float
     *
     * @ORM\Column(name="amount_discount", type="float", precision=12, scale=2, nullable=true)
     */
    private $amountDiscount = '0.00';

    /**
     * @var float
     *
     * @ORM\Column(name="amount_postfee", type="float", precision=12, scale=2, nullable=true)
     */
    private $amountPostfee = '0.00';

    /**
     * @var float
     *
     * @ORM\Column(name="amount_balance", type="float", precision=12, scale=2, nullable=true)
     */
    private $amountBalance = '0.00';

    /**
     * @var float
     *
     * @ORM\Column(name="amount_order", type="float", precision=12, scale=2, nullable=true)
     */
    private $amountOrder = '0.00';

    /**
     * @var float
     *
     * @ORM\Column(name="amount_payment", type="float", precision=12, scale=2, nullable=true)
     */
    private $amountPayment = '0.00';

    /**
     * @var float
     *
     * @ORM\Column(name="amount_need", type="float", precision=12, scale=2, nullable=true)
     */
    private $amountNeed = '0.00';

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="ctime", type="date", nullable=true)
     */
    private $ctime;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="created_at", type="datetime", nullable=false)
     */
    private $createdAt;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="updated_at", type="datetime", nullable=false)
     */
    private $updatedAt;

    /**
     * @var boolean
     *
     * @ORM\Column(name="has_message", type="boolean", nullable=true)
     */
    private $hasMessage = '0';

    /**
     * @var \Method
     *
     * @ORM\ManyToOne(targetEntity="Method")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="method_id", referencedColumnName="id")
     * })
     */
    private $method;

    /**
     * @var \Platform
     *
     * @ORM\ManyToOne(targetEntity="Platform")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="platform_id", referencedColumnName="id")
     * })
     */
    private $platform;

    /**
     * @var \Status
     *
     * @ORM\ManyToOne(targetEntity="Status")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="status_id", referencedColumnName="id")
     * })
     */
    private $status;

    /**
     * @var \Warehouse
     *
     * @ORM\ManyToOne(targetEntity="Warehouse")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="warehouse_id", referencedColumnName="id")
     * })
     */
    private $warehouse;
    
    
    /**
     *
     * @var \OrderAddress
     * @ORM\OneToOne(targetEntity="OrderAddress", mappedBy="order") 
     */
    private $address;
    
    /**
     *
     * @var \OrderItems
     * @ORM\OneToMany(targetEntity="OrderItem", mappedBy="order")
     */
    private $items;



    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set parentId
     *
     * @param integer $parentId
     * @return Order
     */
    public function setParentId($parentId)
    {
        $this->parentId = $parentId;

        return $this;
    }

    /**
     * Get parentId
     *
     * @return integer 
     */
    public function getParentId()
    {
        return $this->parentId;
    }

    /**
     * Set originalNo
     *
     * @param string $originalNo
     * @return Order
     */
    public function setOriginalNo($originalNo)
    {
        $this->originalNo = $originalNo;

        return $this;
    }

    /**
     * Get originalNo
     *
     * @return string 
     */
    public function getOriginalNo()
    {
        return $this->originalNo;
    }

    /**
     * Set orderNo
     *
     * @param string $orderNo
     * @return Order
     */
    public function setOrderNo($orderNo)
    {
        $this->orderNo = $orderNo;

        return $this;
    }

    /**
     * Get orderNo
     *
     * @return string 
     */
    public function getOrderNo()
    {
        return $this->orderNo;
    }

    /**
     * Set amountDiscount
     *
     * @param float $amountDiscount
     * @return Order
     */
    public function setAmountDiscount($amountDiscount)
    {
        $this->amountDiscount = $amountDiscount;

        return $this;
    }

    /**
     * Get amountDiscount
     *
     * @return float 
     */
    public function getAmountDiscount()
    {
        return $this->amountDiscount;
    }

    /**
     * Set amountPostfee
     *
     * @param float $amountPostfee
     * @return Order
     */
    public function setAmountPostfee($amountPostfee)
    {
        $this->amountPostfee = $amountPostfee;

        return $this;
    }

    /**
     * Get amountPostfee
     *
     * @return float 
     */
    public function getAmountPostfee()
    {
        return $this->amountPostfee;
    }

    /**
     * Set amountBalance
     *
     * @param float $amountBalance
     * @return Order
     */
    public function setAmountBalance($amountBalance)
    {
        $this->amountBalance = $amountBalance;

        return $this;
    }

    /**
     * Get amountBalance
     *
     * @return float 
     */
    public function getAmountBalance()
    {
        return $this->amountBalance;
    }

    /**
     * Set amountOrder
     *
     * @param float $amountOrder
     * @return Order
     */
    public function setAmountOrder($amountOrder)
    {
        $this->amountOrder = $amountOrder;

        return $this;
    }

    /**
     * Get amountOrder
     *
     * @return float 
     */
    public function getAmountOrder()
    {
        return $this->amountOrder;
    }

    /**
     * Set amountPayment
     *
     * @param float $amountPayment
     * @return Order
     */
    public function setAmountPayment($amountPayment)
    {
        $this->amountPayment = $amountPayment;

        return $this;
    }

    /**
     * Get amountPayment
     *
     * @return float 
     */
    public function getAmountPayment()
    {
        return $this->amountPayment;
    }

    /**
     * Set amountNeed
     *
     * @param float $amountNeed
     * @return Order
     */
    public function setAmountNeed($amountNeed)
    {
        $this->amountNeed = $amountNeed;

        return $this;
    }

    /**
     * Get amountNeed
     *
     * @return float 
     */
    public function getAmountNeed()
    {
        return $this->amountNeed;
    }

    /**
     * Set ctime
     *
     * @param \DateTime $ctime
     * @return Order
     */
    public function setCtime($ctime)
    {
        $this->ctime = $ctime;

        return $this;
    }

    /**
     * Get ctime
     *
     * @return \DateTime 
     */
    public function getCtime()
    {
        return $this->ctime;
    }

    /**
     * Set createdAt
     *
     * @param \DateTime $createdAt
     * @return Order
     */
    public function setCreatedAt($createdAt)
    {
        $this->createdAt = $createdAt;

        return $this;
    }

    /**
     * Get createdAt
     *
     * @return \DateTime 
     */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    /**
     * Set updatedAt
     *
     * @param \DateTime $updatedAt
     * @return Order
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updatedAt = $updatedAt;

        return $this;
    }

    /**
     * Get updatedAt
     *
     * @return \DateTime 
     */
    public function getUpdatedAt()
    {
        return $this->updatedAt;
    }

    /**
     * Set hasMessage
     *
     * @param boolean $hasMessage
     * @return Order
     */
    public function setHasMessage($hasMessage)
    {
        $this->hasMessage = $hasMessage;

        return $this;
    }

    /**
     * Get hasMessage
     *
     * @return boolean 
     */
    public function getHasMessage()
    {
        return $this->hasMessage;
    }

    /**
     * Set method
     *
     * @param \Ue\ErpBundle\Entity\Method $method
     * @return Order
     */
    public function setMethod(\Ue\ErpBundle\Entity\Method $method = null)
    {
        $this->method = $method;

        return $this;
    }

    /**
     * Get method
     *
     * @return \Ue\ErpBundle\Entity\Method 
     */
    public function getMethod()
    {
        return $this->method;
    }

    /**
     * Set platform
     *
     * @param \Ue\ErpBundle\Entity\Platform $platform
     * @return Order
     */
    public function setPlatform(\Ue\ErpBundle\Entity\Platform $platform = null)
    {
        $this->platform = $platform;

        return $this;
    }

    /**
     * Get platform
     *
     * @return \Ue\ErpBundle\Entity\Platform 
     */
    public function getPlatform()
    {
        return $this->platform;
    }

    /**
     * Set status
     *
     * @param \Ue\ErpBundle\Entity\Status $status
     * @return Order
     */
    public function setStatus(\Ue\ErpBundle\Entity\Status $status = null)
    {
        $this->status = $status;

        return $this;
    }

    /**
     * Get status
     *
     * @return \Ue\ErpBundle\Entity\Status 
     */
    public function getStatus()
    {
        return $this->status;
    }

    /**
     * Set warehouse
     *
     * @param \Ue\ErpBundle\Entity\Warehouse $warehouse
     * @return Order
     */
    public function setWarehouse(\Ue\ErpBundle\Entity\Warehouse $warehouse = null)
    {
        $this->warehouse = $warehouse;

        return $this;
    }

    /**
     * Get warehouse
     *
     * @return \Ue\ErpBundle\Entity\Warehouse 
     */
    public function getWarehouse()
    {
        return $this->warehouse;
    }

    /**
     * Set address
     *
     * @param \Ue\ErpBundle\Entity\OrderAddress $address
     * @return Order
     */
    public function setAddress(\Ue\ErpBundle\Entity\OrderAddress $address = null)
    {
        $this->address = $address;

        return $this;
    }

    /**
     * Get address
     *
     * @return \Ue\ErpBundle\Entity\OrderAddress 
     */
    public function getAddress()
    {
        return $this->address;
    }
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->items = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Add items
     *
     * @param \Ue\ErpBundle\Entity\OrderItem $items
     * @return Order
     */
    public function addItem(\Ue\ErpBundle\Entity\OrderItem $items)
    {
        $this->items[] = $items;

        return $this;
    }

    /**
     * Remove items
     *
     * @param \Ue\ErpBundle\Entity\OrderItem $items
     */
    public function removeItem(\Ue\ErpBundle\Entity\OrderItem $items)
    {
        $this->items->removeElement($items);
    }

    /**
     * Get items
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getItems()
    {
        return $this->items;
    }
}
